<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/admin.css">
<script src="js/jquery.js"></script>
<script src="js/pintuer.js"></script>
  <script type="text/javascript">
    function foodDelete(foodId) {
      if(confirm("您确定要删除这个菜品信息吗？")) {
        console.log("=》进入了js")
        window.location="${pageContext.request.contextPath}/food?action=delete&foodId="+foodId;
      }
    }

    $(document).ready(function(){
      $("ul li:eq(1)").addClass("active");
    });
  </script>
  <script type="text/javascript">
    function updateFood() {
      if(confirm("您确定要发布菜品信息吗？")) {
        console.log("=》进入了js")

      }
      if(confirm("发布菜品信息成功！"));
    }

    $(document).ready(function(){
      $("ul li:eq(1)").addClass("active");
    });
  </script>
</head>
<body>
<div class="panel admin-panel">
  <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong></div>
  <div class="padding border-bottom">
  <button type="button" class="button border-yellow" onclick="window.location.href='#add'"><span class="icon-plus-square-o"></span> 添加内容</button>
  </div>
  <table class="table table-hover text-center">
    <tr>
      <th width="10%">ID</th>
      <th width="20%">图片</th>
      <th width="12%">菜品名</th>
      <th width="10%">价格</th>
      <th width="10%">数量</th>
      <th width="15%">所属店面</th>
      <th width="10%">发布状态</th>
      <th width="15%">操作</th>
    </tr>
<c:forEach var="li" items="${requestScope.listfood}">


    <tr>
      <td>${li.food_id}</td>
      <td><img src="${pageContext.request.contextPath}/images/${li.food_img}" alt="" width="120" height="50" /></td>
      <td>${li.food_name}</td>
      <td>${li.food_price}</td>
      <td>￥${li.food_number}</td>
      <td>桂林米粉店</td>
      <td> ${('0'.equals(li.food_publisher))?'未发布':'已发布'}</td>
      <td><div class="button-group">
      <a class="button border-main" href="food?action=update&UpfoodId=${li.food_id}"  onclick="updateFood()"><span class="icon-edit"></span> 发布</a>
      <a class="button border-red" href="" onclick="foodDelete(${li.food_id})"><span class="icon-trash-o"></span> 删除</a>
      </div></td>
    </tr>
    <tr>
      </c:forEach>


  </table>
</div>
<script type="text/javascript">
function del(id,mid){
	if(confirm("您确定要删除吗?")){

	}
}
</script>





<%--      下面的添加栏--%>
<div class="panel admin-panel margin-top" id="add">
  <div class="panel-head"><strong><span class="icon-pencil-square-o"></span> 增加内容</strong></div>
  <div class="body-content">
    <form method="post" class="form-x" action="food?action=add">
      <div class="form-group">
        <div class="label">
          <label>ID：</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" value="" name="food_id" data-validate="required:请输入标题" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>菜品名：</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" name="food_name" value=""  />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>菜品图片：</label>
        </div>
        <div class="field">
          <input type="text" id="url1" name="food_img" class="input tips" style="width:25%; float:left;"  value="" data-toggle="hover" data-place="right" data-image="" />
          <input type="button" class="button bg-blue margin-left" id="image1" value="+ 浏览上传"  style="float:left;">
          <div class="tipss">图片尺寸：1920*500</div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>价格：</label>
        </div>
        <div class="field">

          <input type="text" class="input w50" name="food_price" value=""  />

          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>斤两：</label>
        </div>
        <div class="field">

          <input type="text" class="input w50" name="food_number" value=""  />

          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>店面信息：</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" name="store_id" value=""  placeholder="桂林米粉店" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">

        <div class="label">
          <label for="sitename">发布状态：</label>
        </div>
        <div class="field">
          <select name="food_publisher" style= " width:250px; " >
            <option value =""> </option>                                   </option>
            <option  value ="0">未发布</option>
            <option value ="1">发布</option>
          </select>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
          <button class="button bg-main icon-check-square-o" type="submit"> 提交</button>
        </div>
      </div>
    </form>
  </div>
</div>
</body></html>
